﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tomssoftware.Html
{
    public class HtmlAttribute
    {
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the value including optional quotes.
        /// </summary>
        public string Value { get; set; }

        /// <summary>
        /// Gets the value without quotes.
        /// </summary>
        public string UnqotedValue
        {
            get
            {
                string v = Value.Trim();
                if (v.Length > 1 && v[0] == '"' && v[v.Length - 1] == '"') return v.Substring(1, v.Length - 2);
                else return Value;
            }
        }

        public HtmlAttribute(string name, string value)
            : base()
        {
            this.Name = name;
            this.Value = value;
        }
    }
}
